package net.csdn.business.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @ClassName: UserScoreEnum
 * @Description:
 * @Author: zhangyl
 * @Date: 2024/5/27 17:20
 */
public interface UserScoreEnum {
    @Getter
    @AllArgsConstructor
    enum RankTypeEnum {
        /**
         * 日榜
         */
        DAY(1, "day", "日榜"),
        /**
         * 周榜
         */
        WEEK(2, "week", "周榜"),
        /**
         * 月榜
         */
        MONTH(3, "month", "月榜"),
        ;
        private final int type;
        private final String code;
        private final String desc;

        public static RankTypeEnum ofCode(String code) {
            for (RankTypeEnum targetType : RankTypeEnum.values()) {
                if (targetType.code.equals(code)) {
                    return targetType;
                }
            }
            throw new IllegalArgumentException("UserScoreEnum#RankTypeEnum param error");
        }
    }
}
